package com.card.admin;

import org.jboss.netty.channel.ChannelHandlerContext;

import com.card.common.MessageComm;
import com.card.message.JsonMessageCenter;
import com.card.setting.GameSetting;
import com.xiaoao.net.json.message.JsonMessage;

/**   
 * @Description: TODO(用一句话描述该文件做什么) 
 * @author siyunlong  
 * @date 2016年12月8日 下午5:24:33 
 * @version V1.0   
 */
public class UpgradeInfo {
	private String version;
	private String versionShort;
	private String build;
	private String installUrl;
	private String update_url;
	private String changelog;
	
	public boolean sendUpgradeMessage(int versionCode,ChannelHandlerContext ctx) {
		boolean qiangzhi = versionCode < GameSetting.getInstance().getMinCode();
		JsonMessage message = JsonMessage.createMessage(MessageComm.S2C_Upgrade_Info);
		message.addProperty("androidXiazai", installUrl);
		message.addProperty("iosXiazai", installUrl);
		message.addProperty("info", changelog==null?"":changelog);
		message.addProperty("qiangzhi", qiangzhi);
		JsonMessageCenter.getInstance().sendMessage(message, ctx);
		return !qiangzhi;
	}
	
	public String getVersion() {
		return version;
	}

	@Override
	public String toString() {
		return "UpgradeInfo [version=" + version + ", versionShort=" + versionShort + ", build=" + build
				+ ", installUrl=" + installUrl + ", update_url=" + update_url + ", changelog=" + changelog + "]";
	}

	public String getChangelog() {
		return changelog;
	}
	
	
}
